{include file="common:teacherheader" /}
{include file="common:teacherside" /}
    <div id="page-wrapper">
      <!-- 舆情日报 -->
      <!--*************************** content部分开始 ******************-->
      <div class="container-fluid" id="m_main">
        <div class="row m-t-20">
          <div class="col-sm-12">
            <div class="white-box">
              <h2 class="box-title m-b-20">修改密码</h2>
              <div class="row">
                <div class="col-sm-4">
                  <div class="form-group">
                    <label class="control-label">账号名：{{account}}</label>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col-sm-4">
                  <div class="form-group">
                    <label class="control-label">原密码：</label>
                    <input type="password" class="form-control" placeholder="" v-model="oldpwd">
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col-sm-4">
                  <div class="form-group">
                    <label class="control-label">新密码：</label>
                    <input type="password" class="form-control" placeholder="" v-model="newpwd">
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col-sm-4">
                  <div class="form-group">
                    <label class="control-label">再次输入密码：</label>
                    <input type="password" class="form-control" placeholder="" v-model="newpwd_confirm">
                  </div>
                </div>
              </div>
              <div class="row m-t-40">
                <div class="col-sm-8 ta-c">
                  <button type="button" name="" class="btn btn-outline btn-primary m-r-40" @click="doSubmit()">提交</button>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- /.row -->
      </div>
      <!--*************************** content部分结束 ******************-->

      <!-- <footer class="footer text-center"> 2017 &copy; Ample Admin brought to you by themedesigner.in </footer> -->
    </div>
  {include file="common:js" /}
  {include file="common:footer" /}

  <script type="text/javascript">
    var vm = new Vue({
      el: '#m_main',
      data() {
        return {
          sid: "{$sid}",
          id: "{$adminInfo.AdminID}",
          account: "{$adminInfo.AdminName}",
          oldpwd: "",
          newpwd: "",
          newpwd_confirm: "",
        }
      },
      mounted() {
      },
      methods: {
        // 提交
        doSubmit(){
          var that = this;
          var param = {
            sid: that.sid,
            id: that.id,
            oldpwd: that.oldpwd,
            newpwd: that.newpwd,
            newpwd_confirm: that.newpwd_confirm
          }

          axios.post('/dboard/teacheradmin/editShopPwd', param,{headers: {'X-Requested-with':'XMLHttpRequest'}}).then(res => {
            // console.log(res);
            if(res.data.Code == 0){
              alert(res.data.Msg)
              window.location.reload();
            }else{
              alert(res.data.Msg)
            }
          }).catch(err => {
            console.log(err);
          })
        }
      }
    })
  </script>
